package com.childenglish.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 可选邮箱验证注解
 * 如果字段为空或null，则跳过验证
 */
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = OptionalEmailValidator.class)
@Documented
public @interface OptionalEmail {
    String message() default "邮箱格式不正确";
    
    Class<?>[] groups() default {};
    
    Class<? extends Payload>[] payload() default {};
}

